<?php
        require('config.php');
	$user_id=$_REQUEST['user_id'];
        $goods_id=$_REQUEST['goods_id'];
        $pan=$_REQUEST['pan'];
        $val=$_REQUEST['val'];
        $attr_id=$_REQUEST['attr_id'];
        if($pan=='isSelected')
        {
                $sql="select * from `".$oto."_car_session` where `userId`='".$user_id."' LIMIT 1";
                $result=$db->query($sql);
                while($row=$result->fetch_assoc()){
                        $person_info[]=$row;//将取得的所有数据赋值给person_info数组
                }
                $car_session=unserialize($person_info[0]['car_session']);
                $i=0;
                foreach($car_session as $k=>$v)
                {
                        if($k==$attr_id)
                        {
                                $car_session[$k]['ischk']=$val;
                                break;
                        }
                        $i++;
                }
                $cart_value=serialize($car_session);
        	$sql="update ".$oto."_car_session set car_session='{$cart_value}' where userId='{$user_id}'";
		$result=$db->query($sql);
        }
        else if($pan=='goods_num')
        {
                $sql="select * from `".$oto."_car_session` where `userId`='".$user_id."' LIMIT 1";
                $result=$db->query($sql);
                while($row=$result->fetch_assoc()){
                        $person_info[]=$row;//将取得的所有数据赋值给person_info数组
                }
                $car_session=unserialize($person_info[0]['car_session']);
                $i=0;
                foreach($car_session as $k=>$v)
                {
                        if($k==$attr_id)
                        {
                                $car_session[$k]['cnt']=$val;
                                break;
                        }
                        $i++;
                }
                $cart_value=serialize($car_session);
        	$sql="update ".$oto."_car_session set car_session='{$cart_value}' where userId='{$user_id}'";
		$result=$db->query($sql);
        }
	echo json_encode($result);
?>